<?php use Symfony\Component\HttpKernel\Controller\ControllerReference; ?>

<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Fiestissima CRM</title>

    <!-- Core CSS - Include with every page -->
    <link href="<?php echo $view['assets']->getUrl('css/bootstrap.min.css') ?>" rel="stylesheet">
    <link href="<?php echo $view['assets']->getUrl('font-awesome/css/font-awesome.css') ?>" rel="stylesheet">

    <!-- Page-Level Plugin CSS - Dashboard -->
    <link href="<?php echo $view['assets']->getUrl('css/plugins/timeline/timeline.css') ?>" rel="stylesheet">

    <!-- SB Admin CSS - Include with every page -->
    <link href="<?php echo $view['assets']->getUrl('css/sb-admin.css') ?>" rel="stylesheet">

    <!-- DateTime picker bootstrap -->
    <link href="<?php echo $view['assets']->getUrl('css/datepicker3.css') ?>" rel="stylesheet">

    <!-- Morris.js charts css-->
    <link href="<?php echo $view['assets']->getUrl('css/plugins/morris/morris.css') ?>" rel="stylesheet">

    <!-- Core Scripts - Include with every page -->
    <script src="<?php echo $view['assets']->getUrl('js/jquery-1.11.1.min.js') ?>"></script>
    <script src="<?php echo $view['assets']->getUrl('js/bootstrap.js') ?>"></script>
    <script src="<?php echo $view['assets']->getUrl('js/plugins/metisMenu/jquery.metisMenu.js') ?>"></script>

    <!-- SB Admin Scripts - Include with every page -->
    <script src="<?php echo $view['assets']->getUrl('js/sb-admin.js') ?>"></script>

    <!-- jquery.numeric plugin -->
    <script src="<?php echo $view['assets']->getUrl('js/jquery.numeric.js') ?>"></script>

    <!-- Routing para Ajax -->
    <script src="<?php echo $view['assets']->getUrl('bundles/fosjsrouting/js/router.js') ?>"></script>
    <script src="<?php echo $view['router']->generate('fos_js_routing_js', array('callback' => 'fos.Router.setData')) ?>"></script>

    <!-- DateTime Picker Bootstrap-->
    <script src="<?php echo $view['assets']->getUrl('js/bootstrap-datepicker.js') ?>"></script>

    <!-- morris.js charts tools-->
    <script src="<?php echo $view['assets']->getUrl('js/plugins/morris/morris.js') ?>"></script>
    <script src="<?php echo $view['assets']->getUrl('js/plugins/morris/raphael-2.1.0.min.js') ?>"></script>
</head>

<body>

    <div id="wrapper">

        <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo $view['router']->generate('fiestissima') ?>">Fiestissima CRM</a>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="modal" data-target="#agregarClienteModal" href="#">
                        <i class="fa fa-plus-square-o fa-fw"></i><i class="fa fa-users fa-fw"></i> Agregar cliente
                    </a>
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="modal" data-target="#agregarProductoModal" href="#">
                        <i class="fa fa-plus-square-o fa-fw"></i><i class="fa fa-shopping-cart fa-fw"></i> Agregar prodcuto
                    </a>
                </li>
            </ul>
            <!-- /.navbar-top-links -->

            <div class="navbar-default navbar-static-side" role="navigation">
                <div class="sidebar-collapse">
                    <ul class="nav" id="side-menu">
                        <li>
                            <a href="#"><i class="fa fa-usd fa-fw"></i> Órdenes de Compra<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="#">Pendientes</a>
                                </li>
                                <li>
                                    <a href="#">Por Cliente</a>
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-users fa-fw"></i> Clientes<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="<?php echo $view['router']->generate('clientesParticulares') ?>">Particulares</a>
                                </li>
                                <li>
                                    <a href="<?php echo $view['router']->generate('clientesEmpresas') ?>">Empresas</a>
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-shopping-cart fa-fw"></i> Productos<span class="fa arrow"></span></a>
                            <?php echo $view['actions']->render(
        						new ControllerReference('FiestissimaCRM:ProductoTipo:menuProductoTipo'))
                            ?>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-truck fa-fw"></i> Logística<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="<?php echo $view['router']->generate('entregaDomicilio') ?>">Entrega a domicilio</a>
                                </li>
                                <li>
                                    <a href="<?php echo $view['router']->generate('distribucion') ?>">Distribución</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="<?php echo $view['router']->generate('reportes') ?>"><i class="fa fa-line-chart"></i> Reportes<span class="fa arrow"></span></a>
                        </li>
                    </ul>
                    <!-- /#side-menu -->
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>
		<!-- agregarClienteModal -->
        <div class="modal fade" id="agregarClienteModal" tabindex="-1" role="dialog" aria-labelledby="agregarClienteModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
  						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">Agregar Cliente</h4>
                    </div>
                    <div class="modal-body">
                        <ul class="nav nav-tabs" role="tablist">
                            <li class="active"><a href="#tabEmpresa" role="tab" data-toggle="tab">Empresa</a></li>
                            <li><a href="#tabParticular" role="tab" data-toggle="tab">Particular</a></li>
                        </ul>

                        <div class="tab-content">
                            <div class="tab-pane fade in active" id="tabEmpresa" style="padding: 15px;">
                                <?php echo $view['form']->start($formEmpresa, array('attr' => array('id' => 'formEmpresa',
                                                                                         'class' => 'form-horizontal',
                                                                                         'role' => 'form')));?>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Razón Social</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formEmpresa['ceRazonSocial'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Contacto</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formEmpresa['ceContacto'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Tipo Documento</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formEmpresa['cTipoDoc'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Nro Documento</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formEmpresa['cNroDoc'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Tipo IVA</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formEmpresa['cTipoIva'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <?php echo $view['form']->end($formEmpresa) ?>

                                <button class="btn btn-primary" type="button" id="btnGuardarEmpresa">Guardar</button>
                            </div>
                            <div class="tab-pane fade" id="tabParticular" style="padding: 15px;">
                                <?php echo $view['form']->start($formPersona, array('attr' => array('id' => 'formPersona',
                                    'class' => 'form-horizontal',
                                    'role' => 'form')));?>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Nombre</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formPersona['cpNombre'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Apellido</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formPersona['cpApellido'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Tipo Documento</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formPersona['cTipoDoc'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Nro Documento</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formPersona['cNroDoc'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="inputInstancia" class="col-sm-4 control-label">Tipo IVA</label>
                                    <div class="col-sm-4">
                                        <?php echo $view['form']->row($formPersona['cTipoIva'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                    </div>
                                </div>
                                <?php echo $view['form']->end($formPersona) ?>
                                <button class="btn btn-primary" type="button" id="btnGuardarPersona">Guardar</button>
                            </div>
                        </div>
                    </div>
				</div>
                <!-- /.modal-content -->
            </div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.agregarClienteModal -->
		<!-- agregarProductoModal -->
        <div class="modal fade" id="agregarProductoModal" tabindex="-1" role="dialog" aria-labelledby="agregarProductoModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
  						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">Agregar Producto</h4>
                    </div>
                    <div class="modal-body">
                    	<?php echo $view['form']->start($formProducto, array('attr' => array('id' => 'formProducto',
		    																	 'class' => 'form-horizontal', 
		    																	 'role' => 'form')));?>
                        <div class="row">
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Nombre</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['prNombre'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Descripción</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['prDescripcion'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Tipo</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['type'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Marca</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['brand'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Stock Inicial</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['prStock'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputInstancia" class="col-sm-4 control-label">Alerta de Stock</label>
                                <div class="col-sm-4">
                                    <?php echo $view['form']->row($formProducto['prStockAlerta'], array('attr' => array('class' => 'form-control'), 'label' => false));?>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <label for="precioProducto" class="col-sm-4 control-label">Precio</label>
                                <div class="col-sm-4">
                                    <input id="producto_precio" class="form-control" type="text" required="required" name="producto[precio]">
                                </div>
                            </div>
                            <?php echo $view['form']->end($formProducto) ?>
                            <div class="form-group">
                                <label for="btnGuardarProducto" class="col-sm-4 control-label">&nbsp;</label>
                                <div class="col-sm-4">
                                    <button id="btnGuardarProducto" class="btn btn-primary" type="button">Guardar</button>
                                </div>
                            </div>
                        </div>
                    </div>
				</div>
                <!-- /.modal-content -->
            </div>
			<!-- /.modal-dialog -->
		</div>
		<!-- /.agregarProductoModal -->